<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <script src="../笔试手写/数字转中文.js"></script> -->
</head>

<body>
    <style>
        #p {
            color: red;
        }

        .green {
            color: green;
        }

        .blue {
            color: blue;
        }
    </style>
    <!-- <div class="red blue green">
        hello word
    </div> -->

    <!-- <p class="p1 p2" id="p" style="color: #222;"></p>
     -->
    <div id="outer">
        <div id="inner">

        </div>
    </div>

    <script>
        var outer = document.querySelector("#outer");
        var inner = document.querySelector("#inner");

        new MutationObserver(function () {
            console.log('moutate')
        }).observe(outer, { attributes: true });

        function onClick() {
            console.log('click');
            setTimeout(function () {
                console.log('timeout');
            }, 0);

            Promise.resolve().then(function () {
                console.log('promise');
            });
            outer.setAttribute('data-random', Math.random());
        }

        inner.addEventListener('click', onClick);
        outer.addEventListener('click', onClick);
        inner.click();
    </script>
</body>

</html>